#include <partical/Particle.h>

namespace ne
{
    Particle::Particle()
        : mass(1.0f),
          position(Vector3::ZERO),
          orientation(Quaternion::IDENTITY),
          scale(Vector3::ONE),
          color(Color::WHITE),
          texCoord(Vector2::ZERO),
          direction(Vector3::UNIT_Z),
          velocity(Vector3::ZERO),
          axis(Vector3::UNIT_Y),
          rotation(0.0f),
          zoom(1.0f),
          totalLifetime(0.0f),
          lifetime(0.0f),
          force(Vector3::ZERO)
    {
    }

    Particle::Particle(const Particle &p)
        : mass(p.mass),
          position(p.position),
          orientation(p.orientation),
          scale(p.scale),
          color(p.color),
          texCoord(p.texCoord),
          direction(p.direction),
          velocity(p.velocity),
          axis(p.axis),
          rotation(p.rotation),
          zoom(p.zoom),
          totalLifetime(p.totalLifetime),
          lifetime(p.lifetime),
          force(p.force)
    {
    }

    Particle& Particle::operator = (const Particle &p)
    {
        mass = p.mass;
        position = p.position;
        orientation = p.orientation;
        scale = p.scale;
        color = p.color;
        texCoord = p.texCoord;
        direction = p.direction;
        velocity = p.velocity;
        axis = p.axis;
        rotation = p.rotation;
        zoom = p.zoom;
        totalLifetime = p.totalLifetime;
        lifetime = p.lifetime;
        force = p.force;
        return *this;
    }

    bool Particle::isDead(const real interval) const
    {
        if (totalLifetime > 0.0f && lifetime + interval > totalLifetime)
        {
            return true;
        }
        return false;
    }

    bool Particle::isParticleEmitter() const
    {
        return false;
    }

    Particle::~Particle()
    {
    }
}
